﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RiaToDalLinq.Attributes
{
    /// <summary>
    /// Marks a code parameter as one whose ID needs to be looked up before being passed to the DAL
    /// </summary>
    [System.AttributeUsage(System.AttributeTargets.Parameter)]
    public class CodeToIdMap : Attribute
    {
        private string _lookupIdField = string.Empty;
        private string _lookupCodeField = string.Empty;
        private Type _lookupEntityType;

        public CodeToIdMap(Type lookupEntityType, string lookupCodeField, string lookupIdField)
        {
            _lookupIdField = lookupIdField;
            _lookupCodeField = lookupCodeField;
            _lookupEntityType = lookupEntityType;
        }

        public string LookupIdField
        {
            get
            {
                return _lookupIdField;
            }
        }

        public string LookupCodeField
        {
            get
            {
                return _lookupCodeField;
            }
        }

        public Type DestinationType
        {
            get
            {
                return _lookupEntityType;
            }
        }
    }
}
